extends Area2D

@onready var timer: Timer = $Timer

func _on_body_entered(body: Node2D) -> void:
	print("You died!")
	# 将游戏中的一切减速
	Engine.time_scale = 0.5
	body.get_node("CollisionShape2D").queue_free()
	timer.start()

#计时器结束后运行
func _on_timer_timeout() -> void:
	Engine.time_scale = 1.0
	#获取场景树，重新加载加载当前场景
	get_tree().reload_current_scene()
